package com.sprouting.ops.model;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.ops.annotations.invoke.CheckIsNullOrEmpty;
import com.sprouting.ops.annotations.invoke.CheckLength;
import com.sprouting.ops.annotations.invoke.CheckNotNull;
import com.sprouting.ops.interfaces.AddGroup;
import com.sprouting.ops.interfaces.UpdGroup;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 权限
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2023/11/4 17:58
 */
@TableName("ops_authority")
@Data
public class OpsAuthority {

    /**
     * 主键
     */
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @CheckIsNullOrEmpty(message = "无效ID", groups = AddGroup.class)
    @TableId
    private String id;
    /**
     * 权限名称
     */
    @CheckLength(min = 1, max = 200, message = "权限名称超过长度限制")
    @CheckNotNull(message = "请输入权限名称")
    private String name;
    /**
     * 权限说明
     */
    @CheckLength(min = 1, max = 1000, message = "权限说明超过长度限制")
    @CheckNotNull(message = "请输入权限说明")
    private String description;
    /**
     * 权限代码,有且唯一
     */
    @CheckLength(min = 1, max = 100, message = "权限代码超过长度限制")
    @CheckNotNull(message = "请输入权限代码")
    private String code;
    /**
     * 上级权限ID，顶级为-1
     * @see com.sprouting.ops.interfaces.ConstantBase.DefaultValue#STRING
     * @see OpsAuthority#getId()
     */
    @CheckNotNull(message = "请选择上级权限")
    private String parentId;
    /**
     * 所有上级权限，不含-1
     * @see OpsAuthority#getId()
     */
    private String parentIds;
    /**
     * 权限类型，接口、菜单、按钮
     * @see com.sprouting.ops.interfaces.ConstantBase.AuthorityType
     */
    @NotNull(message = "请选择权限类型")
    private Integer type;
}
